package com.ktjy.service.impl;


import com.ktjy.entity.User;
import com.ktjy.mapper.UserMapper;
import com.ktjy.mapper.impl.UserMapperImpl;
import com.ktjy.service.UserService;

public class UserServiceImpl implements UserService {
    private UserMapper userMapper=new UserMapperImpl();
    @Override
    public int register(User user) {
        return userMapper.insert(user);
    }

    @Override
    public int update(User user) {
        return userMapper.update(user);
    }

    @Override
    public User login(String userName, String password) {
        User user=userMapper.selectByUserName(userName);

        if(user!=null){
            //判断账号状态

            //密码匹配
            if(user.getUserPassword().equals(password)){
                return user;
            }
        }
        return null;
    }
}
